DMA controller and DMA transfer method

ABSTRACT

A DMA channel data quantity setting section sets a data transfer quantity of each of a plurality of DMA channels in accordance with a data quantity or a ratio in advance. A channel select control circuit determines whether each DMA channel is active. A data transfer control circuit transfers the data of the DMA channel determined to be active by the channel select control circuit in accordance with the data transfer quantity of each DMA channel set by the DMA channel data quantity setting section. By doing so, a plurality of DMA requests are accepted per bus hold request, and the number of bus management right arbitration procedures and the latency between the channels are decreased.

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application is based upon and claims the benefit of priority from the prior Japanese Patent Application No.2002-252704, filed on Aug. 30, 2002, the entire contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

[0002] 1) Field of the Invention

[0003] The present invention relates to a direct memory access (DMA) controller that performs DMA transfer for a plurality of data transfer channels, and a DMA transfer method therefor.

[0004] 2) Description of the Related Art

[0005] A system that employs a central processing unit (“CPU”) conventionally has a DMA transfer function. The DMA transfer function means performing data transfer without causing the CPU to intervene so as to transfer data between a plurality of peripherals and a memory at high rate. This DMA transfer function is controlled by a DMA controller, the basic operation of which will be explained below.

[0006] If a DMA request is issued from a peripheral allocated to each channel, to the DMA controller, the DMA controller issues a bus hold request to the CPU. If a plurality of DMA requests are issued from peripherals, the DMA controller prepares for data transfer for the highest priority channel in accordance with preset priorities.

[0007] If the CPU accepts the bus hold request from the DMA controller, the CPU hands over a bus management right to the DMA controller. The DMA controller starts the data transfer between the memory and the peripherals using the bus as a DMA transfer data path. The data transfer is performed while DMA requests are continuously issued. In a burst mode, the data transfer of a preset size can be performed.

[0008] However, the conventional technique is always required to take arbitration procedures for the bus management right between the DMA controller and the CPU as a preparation for starting the DMA transfer. As a result, if the DMA transfer is frequently performed, the arbitration procedures disadvantageously deteriorate data transfer efficiency.

[0009] Although it is possible to decrease DMA transfer frequency by using the burst mode, the burst mode increases a data length and bus occupation time per channel tends to increase, accordingly. This results in an increase in wait time until a DMA request is processed, disadvantageously causing latency to the data between the channels. Besides, a buffer necessary to hold data needs to be large in size.

SUMMARY OF THE INVENTION

[0010] It is an object of the present invention to at least solve the problems in the conventional technology.

[0011] The DMA controller according to one aspect of the present invention comprises a data quantity setting unit that sets a data transfer quantity of each of a plurality of DMA channels; a channel select control unit that determines whether each DMA channel is active; and a data transfer control unit that transfers data of each of the DMA channels determined to be active by the channel select control unit, in accordance with the data transfer quantity of each DMA channel set by the data quantity setting unit.

[0012] According to the above aspect, DMA requests from a plurality of peripherals existing on the same bus are simultaneously accepted when a right to use the bus is acquired once, it is determined whether each of the DMA channels is active, and DMA transfer is performed based on the preset data transfer quantity of each of the DMA channels. At this moment, the data transfer quantity of each DMA channel for a total quantity of the data to be transferred when the right to use the bus is acquired is transferred in accordance with a fixed data quantity or a channel specific ratio.

[0013] These and other objects, features and advantages of the present invention are specifically set forth in or will become apparent from the following detailed descriptions of the invention when read in conjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

[0014]FIG. 1 is a block diagram that shows the basic configuration of a DMA controller according to the present invention;

[0015]FIG. 2 is a block diagram that shows the configuration of a first embodiment of the DMA controller according to the present invention;

[0016]FIGS. 3A and 3B are tables that show an example of the configuration of a channel ratio register;

[0017]FIG. 4 is a block diagram that shows an example of the setting of a 1ChBurst length arithmetic circuit;

[0018]FIG. 5 is a timing chart that explains a DMA transfer processing in the first embodiment;

[0019]FIG. 6 is a block diagram that shows another example of the configuration of the 1ChBurst length arithmetic circuit;

[0020]FIG. 7 is a timing chart that explains a DMA transfer processing in a second embodiment;

[0021]FIG. 8 is a timing chart that explains a DMA transfer processing in the configuration of a third embodiment;

[0022]FIG. 9 is a block diagram that shows the configuration of a fourth embodiment of the DMA controller according to the present invention; and

[0023]FIG. 10 is a table that shows one example of the configuration of a channel burst length register.

DETAILED DESCRIPTION

[0024] Exemplary embodiments of the DMA controller and the DMA transfer method according to the present invention will be explained hereinafter in detail with reference to the accompanying drawings. A channel band guarantee type DMA controller according to the present invention processes DMA requests from a plurality of peripherals that exist on the same bus when a right to use the bus is acquired once.

[0025]FIG. 1 is a block diagram that shows the basic configuration of the DMA controller according to the present invention. Peripherals (peripheral-1 to peripheral-n) 2 a to 2 n for a plurality of DMA channels (hereinafter “channels”) Ch1 to Chn, a CPU 3, and a memory 4 are connected to the DMA controller (DMAC) 1. The DMA transfer is performed between the peripherals 2 a to 2 n and the memory 4 through a bus (hereinafter “data/address bus”) 5 under the control of the DMA controller 1.

[0026] The DMA controller 1 includes an interface (I/F) circuit 10, a channel select control circuit 11, a DMA channel data quantity setting section 12, a burst length counter (hereinafter “1ChBurst counter”) 13, a channel control circuit 14, and a data transfer control circuit 15. The I/F circuit 10 controls the data transfer for the data of the peripherals 2 a to 2 n on the respective channels. The channel select control circuit 11 determines whether the DMA channels are active based on transfer requests DREQ output from the peripherals 2 a to 2 n, and selects the execution of the DMA transfer of the data of one active DMA channel. The DMA channel data quantity setting section 12 presets the data transfer quantity of each channel. The burst length counter 13 counts the burst length of each channel. The channel control circuit 14 counts the data and address of each channel. The data transfer control circuit 15 arbitrates a bus use right between the DMA controller 1 and the CPU 3, and controls data transfer operations such as DMA read/write. FIG. 2 is a block diagram that shows detailed configuration of the DMA controller 1. This DMA controller is configured to set the data quantity of each DMA channel in accordance with the ratio of the data quantity of each channel to a total data quantity to be transferred by the DMA controller when one bus right is acquired.

[0027] The DMA controller 1 comprises the DMA channel data quantity setting section 12. The DMA channel data quantity setting section 12 includes a channel ratio register 20, a burst length arithmetic circuit (hereinafter “1ChBurst length arithmetic circuit”) 21, a burst length holding circuit 22, and a total burst length register 23. The channel ratio register 20 sets the ratio of each data quantity to the total data quantity. The burst length arithmetic circuit 21 operates a data quantity from the ratio of the data quantity to the total data quantity. The burst length holding circuit 22 holds the data quantity of each channel thus operated. The total burst length register 23 sets the burst length of the total transfer quantity.

[0028]FIGS. 3A and 3B are tables that show one example of the configuration of the channel ratio register 20. The channel ratio register 20 sets the ratio of the data quantity of each DMA channel to the total data quantity. It is possible to set four ratios as shown in FIG. 3B using two bits of RT1 and RT0 shown in FIG. 3A for each channel Ch. For example, for a certain channel, if the bit RT1 is set at “0” and the bit RT0 is set at “1”, it is possible to set the ratio of the data quantity of the certain channel to the total data quantity at 25% of the total transfer rate. If the number of bits shown in FIG. 3B increases, it is possible to set ratios more minutely.

[0029] The configuration of the 1ChBurst length arithmetic circuit 21 can be changed, depending on whether an empty area is used. That is, it is possible to determine whether to transfer the data of active DMA channels during the transfer time (empty time) of an inactive DMA channel.

[0030]FIG. 4 is a block diagram that shows one example of the setting of the 1ChBurst length arithmetic circuit 21. With this configuration, no empty area is used. Mask circuits Ch1 (31 a) to Chn (31 n) are provided to correspond to the respective channels. Active signals (ACT_Ch1 to ACT_Chn) from the channel select control circuit 11 and channel ratio signals (Ch1_Ratio to Chn_Ratio) from the channel ratio register 20 are input into the mask circuits 31 a to 31 n for the respective channels.

[0031] The mask circuits for channels 1 (Ch1) to n (Chn) 31 a to 31 n operate the ratios of the data quantities of the respective channels based on the ratios of the corresponding channel ratio signals when the corresponding active signals are active, and output the operation results to corresponding multipliers 32 a to 32 n. A total data quantity (TotalBurst length) is input into the multipliers 32 a to 32 n from the total burst length register 23. The multipliers 32 a to 32 n operate the data quantities of the corresponding channels (Ch1Burst length to ChnBurst length) and output the operation results, respectively. If the corresponding active signals are inactive, the mask circuits 31 a to 31 n output 0(%) as the ratios of the data quantities of the respective channels.

[0032] A fixed data quantity is allocated to each channel, irrespective of the state of the channel (active or inactive). Therefore, during empty time, the data of other active DMA channels is not transferred and the bus use right is abandoned.

[0033]FIG. 5 is a timing chart that explains a DMA transfer processing in the first embodiment. Setting conditions are as follows. The total burst length of the total burst length register 23 is 16-bytes, and the Ch1_Ratio, Ch2_Ratio, and Chn_Ratio of the channel ratio register 20 is 50%, 25%, and 25%, respectively.

[0034] Among the peripherals 2 a to 2 n, the peripherals 2 a and 2 b first output transfer requests DREQ_1 and DREQ_2, respectively (at time T1). If a transfer request DREQ_n is delayed (output at time T2), the channel select control circuit 11 determines that only the channels Ch1 and Ch2 are active (outputs ACT_Ch1 and ACT_Ch2) based on the rise of the initially output transfer requests DREQ_1 and DREQ_2. The data transfer control circuit 15 outputs one bus hold request (HOLD) to the CPU 3.

[0035] Thereafter, the 1ChBurst length arithmetic circuit 21 operates the ratio of the data quantity of each channel, and DMA transfer is performed for the active channels based on the corresponding ratios. In the example of FIG. 5, the channel select control circuit 11 determines that only the channels Ch1 and Ch2 are active, 50% of 16-bytes that is TotalBurst length, i.e., the data of 8-bytes of the channel Ch1 is DMA-transferred, and 25% of 16-bytes that is TotalBurst length, i.e., the data of 4-bytes of the channel Ch2 is DMA-transferred.

[0036] Consequently, the data of only the channels Ch1 and Ch2 for which DMA transfer requests are issued from the corresponding peripherals and which are determined active, is DMA-transferred by one bus use right. At this moment, since the empty capacity is not used, only the data of 12-bytes of the channels Ch1 and Ch2 among 16-bytes that is the total quantity of data to be used, is transferred. During transfer expected time (time T3) allocated to the channel Chn, the bus use right is abandoned.

[0037]FIG. 6 is a block diagram that shows another example of the configuration of the 1ChBurst length arithmetic circuit as a second embodiment of the present invention. An empty area is reset in accordance with the ratio of the data quantity of each DMA channel. The mask circuits 31 a to 31 n are provided for each of the channels 1 (Ch1) to n (Chn). The active signals (ACT_Ch1 to ACT_Chn) from the channel select control circuit 11 and the channel ratio signals (Ch1Ratio to Chn_Ratio) from the channel ratio register 20 are input into the mask circuits 31 a to 31 n for the respective channels.

[0038] The mask circuits 31 a to 31 n operate the ratios (%) of the data quantities of the respective channels based on the ratios of the corresponding channel ratio signals, and output the operation results to corresponding dividers 34 a to 34 n provided in rear of the mask circuits 31 a to 31 n, respectively, and to an adder 33. The adder 33 adds the ratios of the data quantities of all the active channels, and outputs the addition result to the dividers 34 a to 34 n. Therefore, the dividers 34 a to 34 n can operate again the ratios (%) of the data quantities of the respective channels in accordance with the ratios of the corresponding channel ratio signals based on the ratios (%) of the data quantities of all the active channels.

[0039] Thereafter, the ratios (%) of the data quantities of the channels are output to the multipliers 32 a to 32 n, respectively. The total data quantity (Totalburst length) is input into the multipliers 32 a to 32 n from the total burst length register 23. The multipliers 32 a to 32 n operate the data quantities of the corresponding channels (Ch1Burst length to ChnBurst length) and output the operation results, respectively.

[0040] If an empty area occurs, it is possible to allocate data quantities to all the active channels based on the corresponding channel ratios.

[0041]FIG. 7 is a timing chart that explains a DMA transfer processing in the second embodiment. Setting conditions are as follows. The total burst length of the total burst length register 23 is 16-bytes, and the Ch1_Ratio, Ch2_Ratio, and Chn_Ratio of the channel ratio register 20 is 50%, 25%, and 25%, respectively.

[0042] Among the peripherals 2 a to 2 n, the peripherals 2 a and 2 b first output transfer requests DREQ_1 and DREQ_2, respectively (at the time T1). If a transfer request DREQ_n is delayed (output at the time T2), the channel select control circuit 11 determines that only the channels Ch1 and Ch2 are active (outputs ACT_Ch1 and ACT_Ch2) based on the rise of the initially output transfer requests DREQ_1 and DREQ_2. The data transfer control circuit 15 outputs one bus hold request (HOLD) to the CPU 3.

[0043] Thereafter, the 1ChBurst length arithmetic circuit 21 operates the ratio of the data quantity of each channel, the total data quantity of the active channels is divided by the ratio of each channel and DMA transfer is performed based on the corresponding ratios. In the example of FIG. 7, the channel select control circuit 11 determines only the channels Ch1 and Ch2 are active. At this moment, the ratios of the data quantities of the channels Ch1 and Ch2 are adjusted to be equal to 100%. The ratios of the channels Ch1 and Ch2 are Ch1:Ch2=50%:25%=2:1. Therefore, if the ratios are recalculated based on the total ratio (100%), the ratios of the data quantities of the channels Ch1 and Ch2 are Ch1=⅔=66.6% and Ch2=⅓=33.3%. As a result, 66.6% of 16-bytes that is TotalBurst length, i.e., the data of 10-bytes of the channel Ch1 is DMA transferred, and 33.3% of 16-bytes that is TotalBurst length, i.e., the data of 6-bytes of the channel Ch2 is DMA transferred (at time T3).

[0044] Consequently, the data of only the channels Ch1 and Ch2 for which DMA transfer requests are issued from the corresponding peripherals and which are determined active, are DMA-transferred by one bus use right. At this moment, an empty capacity is re-allocated to each channel in accordance with the ratios of the active channels. Thus, it is possible to transfer the data of all the data quantity 16-bytes to be used as the data of only the active channels Ch1 and Ch2 at all the time including the Chn transfer expected time.

[0045] As a third embodiment of the present invention, the DMA transfer of the data of the channels Ch1 to Chn that become active is executed in the period of one bus hold request (HOLD), irrespective of whether a plurality of DMA transfer requests are output simultaneously. FIG. 8 is a timing chart that explains a DMA transfer processing in the configuration of the third embodiment. Setting conditions are the same as those in the preceding embodiments. Namely, the total burst length of the total burst length register 23 is 16-bytes, and the Ch1_Ratio, Ch2_Ratio, and Chn_Ratio of the channel ratio register 20 is 50%, 25%, and 25%, respectively.

[0046] It is assumed herein that the peripherals 2 a and 2 b, for example, among the peripherals 2 a to 2 n first output transfer requests DREQ_1 and DREQ_2 (at the time T1), and the transfer request DREQ_n is delayed (output at the time T2). If so, the channel select control circuit 11 first determines that the channels Ch1 and Ch2 are active (outputs ACT_Ch1 and ACT_Ch2) based on the rise of the transfer requests DREQ_1 and DREQ_2.

[0047] The data quantity of each channel is such that the empty area is not used. The 1ChBurst length arithmetic circuit 21 operates the ratio of the data quantity of each channel, and DMA transfer is executed based on the ratios for the active channels. In the example shown, only the channels Ch1 and Ch2 are determined to be active, 50% of 16-bytes that is TotalBurst length, i.e., the data of 8-bytes of the channel Ch1 is DMA transferred, and 25% of 16-bytes that is TotalBurst length, i.e., the data of 4-bytes of the channel Ch2 is DMA transferred.

[0048] One bus hold request (HOLD) is output to the CPU 3, whereby pieces of data of the channels Ch1 and Ch2 are sequentially DMA-transferred. If the following channel (Chn) becomes active before the data of the final channel (channel Ch2 in this example) for which the DMA transfer is performed is finished (at the time T2), the channel select control circuit 11 executes DMA transfer (4-bytes) of the channel Chn that becomes active in the period in which this one bus use right is acquired (at the time T3).

[0049] According to the third embodiment, even if an additional DMA transfer request is output for a certain channel, DMA transfer operations can be continuously executed as long as this additional request is output before the DMA transfer of the active channel is finished, irrespective of whether a plurality of DMA transfer requests are simultaneously output.

[0050]FIG. 9 is a block diagram that shows the configuration of a fourth embodiment of the channel band guarantee type DMA controller according to the present invention. In the fourth embodiment, the data quantity of each channel to be transferred by the DMA controller by one bus right acquisition is preset in bytes. The DMA channel data quantity setting section 12 consists of a channel burst length register 40 that sets the data quantity of each channel in bytes, and a selector 41 that outputs the data quantities of currently active channels from the channel burst length register 40 to a read 1 ChBurst counter 13.

[0051]FIG. 10 is a table that shows one example of the configuration of the channel burst length register 40. The channel burst length register 40 sets a fixed data quantity (in bytes) to be transferred at each of the bits (Bit0 to Bit7) of the respective channels. By setting so, it is possible to specify the data quantities to be transferred of a plurality of channels when one bus use right is acquired.

[0052] As explained so far, the channel band guarantee type DMA controller in the embodiments of the present invention can transfer the data of a plurality of channels in accordance with respective predetermined ratios whenever one bus use right is acquired.

[0053] According to the present invention, when one bus hold request is issued, the band is guaranteed for each channel and the data of the respective channels is continuously DMA-transferred in response to a plurality of DMA transfer requests output from a plurality of peripherals existing on the same bus. It is, therefore, possible to decrease the number of bus management right arbitration procedures and the latency between the channels, to improve transfer efficiency, and to guarantee the minimum transfer rate of each channel. It is thereby possible to facilitate the management of the bus at the time of designing a system.

[0054] Although the invention has been described with respect to a specific embodiment for a complete and clear disclosure, the appended claims are not to be thus limited but are to be construed as embodying all modifications and alternative constructions that may occur to one skilled in the art which fairly fall within the basic teaching herein set forth. 

What is claimed is:
 1. A direct memory access controller having a plurality of direct memory access channels, and that processes direct memory access requests from a plurality of peripherals existing on a single bus when a right to use the bus is acquired once, the direct memory access controller comprising: a data quantity setting unit that sets a data transfer quantity, which indicates an amount of data to be transferred, for each of the direct memory access channels; a channel select control unit that determines whether each of the direct memory access channels is active; and a data transfer control unit that transfers the data of the direct memory access channel determined to be active by the channel select control unit in accordance with the data transfer quantity of the direct memory access channel set by the data quantity setting unit.
 2. The direct memory access controller according to claim 1, wherein the data quantity setting unit sets a ratio of an amount of data that can be transferred through each of the direct memory access channels to a total amount of data that can be transferred when the right to use the bus is acquired as the data transfer quantity.
 3. The direct memory access controller according to claim 2, wherein the data quantity setting unit comprises: a channel ratio register that sets the ratio of the data quantity of each of the direct memory access channel to the total data quantity to be transferred when the right to use the bus is acquired; and a burst length arithmetic unit that operates the data quantity of each of the direct memory access channels to the total data quantity based on the ratio set by the channel ratio register.
 4. The direct memory access controller according to claim 1, wherein the data quantity setting unit sets an amount of data that can be transferred through each of the direct memory access channels when the right to use the bus is acquired as the data transfer quantity.
 5. The direct memory access controller according to claim 4, wherein the data quantity setting unit comprises: a burst length register that sets the data quantity of each of the direct memory access channels to be transferred when the right to use the bus is acquired; and a selector that reads the data quantity of each of the direct memory access channels set by the burst length register.
 6. The direct memory access controller according to claim 1, wherein the channel select control unit selects the direct memory access channels for which direct memory access transfer requests are output before the right to use the bus is acquired.
 7. The direct memory access controller according to claim 1, wherein the channel select control unit selects the direct memory access channels based on direct memory access transfer requests while the right to use the bus is acquired, and selects a new channel for which a direct memory access transfer request is output if the direct memory access transfer request is issued for the new channel before the direct memory access transfer of the final channel among the selected channels is finished.
 8. The direct memory access controller according to claim 1, wherein the data quantity setting unit sets an empty band allocated to the direct memory access channel for which the direct memory access transfer request is not issued, unused and clears the right to use the bus if the direct memory access channel for which the direct memory access transfer request is not issued exists.
 9. The direct memory access controller according to claim 1, wherein the data quantity setting unit reallocates an empty band allocated to the direct memory access channel for which the direct memory access transfer request is not issued, to the direct memory access channels for which the direct memory access transfer requests are issued, in accordance with predetermined ratios, respectively if the direct memory access channels for which the direct memory access transfer request is issued exists.
 10. The direct memory access controller according to claim 9, wherein the predetermined ratios by which the data quantity setting unit allocates the empty band to the respective direct memory access channels, are set according to the ratio of each of the direct memory access channels set by the data quantity setting unit.
 11. A direct memory access transfer method employed by a direct memory access controller having a plurality of direct memory access channels, and that processes direct memory access requests from a plurality of peripherals existing on a single bus when a right to use the bus is acquired once, the direct memory access transfer method comprising: setting a data transfer quantity, which indicates an amount of data to be transferred, for each of the direct memory access channels; determining whether each of the direct memory access channels is active; and transferring the data of the direct memory access channel determined to be active at the determining in accordance with the data transfer quantity of the direct memory access channel set at the setting.
 12. The direct memory access transfer method according to claim 11, wherein at the setting, a ratio of an amount of data that can be transferred through each of the direct memory access channels to a total amount of data that can be transferred when the right to use the bus is acquired is set as the data transfer quantity.
 13. The direct memory access transfer method according to claim 11, wherein at the setting, an amount of data that can be transferred through each of the direct memory access channels when the right to use the bus is acquired is set as the data transfer quantity. 